<!DOCTYPE html>
<meta charset="utf-8">
<!-- Generate token with the command:
generate_token.py http://127.0.0.1:8000 GenericSensor --expire-timestamp=2000000000
-- -->
<meta http-equiv="origin-trial" content="Ahb93LnjsT5hSVc86NOCTNo0iS8tQmrbb/S6+Y5N6RWAWEMxgHdXG3hE+uFMF3A1PcUnlmLbhzW/f8/8PXz2ugQAAABVeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiR2VuZXJpY1NlbnNvciIsICJleHBpcnkiOiAyMDAwMDAwMDAwfQ==" />
<title>GenericSensor - interfaces exposed by origin trial</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/origin-trials-helper.js"></script>
<script>
test(t => {
  OriginTrialsHelper.check_properties_exist(this,
      {'Sensor': ['start', 'stop', 'hasReading', 'activated', 'timestamp', 'onerror', 'onreading', 'onactivate'],
       'Accelerometer': ['x', 'y', 'z'],
       'Gyroscope': ['x', 'y', 'z'],
       'OrientationSensor': ['quaternion', 'populateMatrix']
       });
}, 'Sensor related interfaces and properties in Origin-Trial enabled document.');

async_test(function(test) {
  Promise.all([navigator.permissions.query({ name: "accelerometer" }),
               navigator.permissions.query({ name: "magnetometer" }),
               navigator.permissions.query({ name: "gyroscope" })])
    .then(results => {
      test.done();
    }).catch(() => {
      assert_unreached('querying sensors permissions should not fail.')
    });
}, 'Test sensors permissions in Origin-Trial enabled document.');

</script>
